import { Category } from '../models/category'

export const GET_CATEGORY_LIST = 'GET_CATEGORY_LIST'
export const GET_CATEGORY_LIST_SUCCESS = 'GET_CATEGORY_LIST_SUCCESS'
export const GET_CATEGORY_LIST_FAILURE = 'GET_CATEGORY_LIST_FAILURE'

export interface GetCategoryListAction {
  type: typeof GET_CATEGORY_LIST
}

export interface GetCategoryListSuccessAction {
  type: typeof GET_CATEGORY_LIST_SUCCESS
  payload: Category[]
}

export interface GetCategoryListFailureAction {
  type: typeof GET_CATEGORY_LIST_FAILURE
  payload: {
    error: string
  }
}

export type CategoryActionTypes =
  | GetCategoryListAction
  | GetCategoryListSuccessAction
  | GetCategoryListFailureAction
